From: Ian Jackson Date: Tue, 10 Feb 2015 20:09:48 +0000 (+0000) Subject: libxl: Further fix exit paths from libxl_device_events_handler X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3511 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=62cba1bec4222e9b4882a7ecbcb92e55659a6baa;p=xen.git libxl: Further fix exit paths from libxl_device_events_handler On the success path, do not call GC_FREE explicitly. Instead, call AO_INPROGRESS. GC_FREE will free the gc underlying the long-term ao, which is then subsequently referenced in backend_watch_callback's call to libxl__nested_ao_create. It is a miracle that this ever works at all. Also, add an `if (rc) goto out;' after the xswatch registration. After this, libxl_device_events_handler has the conventional and correct ao initiation pattern. Signed-off-by: Ian Jackson CC: Roger Pau Monne Acked-by: Roger Pau Monné Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index e9b4ed3191..2a735b3d5b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4592,11 +4592,12 @@ int libxl_device_events_handler(libxl_ctx *ctx, be_path = GCSPRINTF("/local/domain/%u/backend", domid); rc = libxl__ev_xswatch_register(gc, &ddomain.watch, backend_watch_callback, be_path); + if (rc) goto out; -out: - GC_FREE; - if (rc) return AO_ABORT(rc); return AO_INPROGRESS; + +out: + return AO_ABORT(rc); } /******************************************************************************/